﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        short binNumber = short.Parse(keypad.Value.ToString());

        Container container;

        using (CCSEntities db = new CCSEntities())
        {
            container = (from c in db.Containers
                         where c.BinNumber == binNumber
                         select c).FirstOrDefault();

        }

        if (container != null)
        {
            Response.Redirect("edit.aspx?id=" + container.ContainerID);
            //Response.Redirect("edit/?id=" + container.ContainerID);
        }
        else
        {
            //lblError.Text = string.Format("{0} is an invalid Bin Number", binNumber);
            lblError.Text = "Invalid Bin Number!";
        }
    }
}